.\"                                      Hey, EMACS: -*- nroff -*-
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH DUPMERGE2 1 "September 26, 2011"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
.\" .nh        disable hyphenation
.\" .hy        enable hyphenation
.\" .ad l      left justify
.\" .ad b      justify to both left and right margins
.\" .nf        disable filling
.\" .fi        enable filling
.\" .br        insert line break
.\" .sp <n>    insert n+1 empty lines
.\" for manpage-specific macros, see man(7)
.SH NAME
dupmerge2 \- finds and hardlinks identical files
.SH SYNOPSIS
.B dupmerge2
.RI [ options ] 
.I searchpath
.SH DESCRIPTION
.B dupmerge2
finds identical files in a given directory, identify identical files and hardlink them to save space. It has the ability to produce
ouput for zenity --progress. 

The program operates in 4 steps:

1. it reads the list and stores the names in memory

2. it gets information about the file (size, inode, device, #blocks) and store it into an array

3. it sorts the array so that a. they are sorted by device, b. larger files come first, c. files with same inodes (i.e. hardlinked) are consecutives.
The method used is recursive, based on a fusion algorythm.

4. it compares the files and hardlink them. It reads the array, takes a file, ignores other files hardlinked to it, compares other files with the same size, hardlinks them if they are identical and also hardlink other files hardlinked to the similar file.


The initial concept is from 
.B dupmerge(1)
1.73 by Phil Karn, has less features but hopefully offers better performance. It adds the ability to output to zenity progress bar and scans the directory with ftw. 
It should also better handle existing hardlinks (skipping the file comparison).

.SH OPTIONS
.IP -h
Show help.
.IP -t
Test mode: don't make actual changes, just report what would be done.
.IP -v
Verbose mode.
.IP -V
Show program version.
.IP -z
Output progress information for the
.B zenity --progress
command.

.SH EXAMPLES
TODO Examples
.SH BUGS
The program compiles correctly with g++ in 64 bits. Not tested in 32 bits at this point.
.SH AUTHOR
Ludovic Seegmuller <draco91@bigfoot.com>


